<template>
  <div class="main"></div>
</template>

<script>
import { setToken } from '@/utils/auth'
import qs from 'qs'

export default {
  name: 'SinglePoint',
  data() {
    return {
      loginToken: true
    }
  },
  computed: {
    message() {
      return '找不到网页！'
    }
  },
  created() {
    var query = qs.parse(decodeURIComponent(location.search.substring(1)))

    if (query.token) {
      setTimeout(() => {
        setToken(query.token)
        uni.showToast({
            title: "登陆成功",
            duration: 2000,
        });
		
		this.$store.commit('SET_TOKEN', query.token)
		this.$store.dispatch('GetInfo').then(()=>{
			uni.reLaunch({
				url: '/pages/home/home'
			});		
		})
		
      }, 500)
    } else {
      setTimeout(() => {
        uni.showToast({
            icon: 'none',
            title: "登陆失败",
            duration: 2000,
        });
		uni.reLaunch({
			url: '/pages/login/login'
		});		
      }, 500)
    }
  }
}
</script>

<style lang="scss" scoped>
.main{
	width: 100%;
	height: 100%;
	background: white;
}
</style>

